package com.kingdee.eas.custom.hostelmgr.personrating.app;

import org.apache.log4j.Logger;
import javax.ejb.*;
import java.rmi.RemoteException;
import com.kingdee.bos.*;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.rule.RuleExecutor;
import com.kingdee.bos.metadata.MetaDataPK; //import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.framework.ejb.AbstractEntityControllerBean;
import com.kingdee.bos.framework.ejb.AbstractBizControllerBean; //import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.service.ServiceContext;
import com.kingdee.bos.service.IServiceContext;

import java.lang.String;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.eas.custom.hostelmgr.hostelrating.HostelRatingInfo;
import com.kingdee.eas.custom.hostelmgr.personrating.PersonRatingInfo;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.eas.framework.SystemEnum;
import com.kingdee.eas.framework.CoreBillBaseCollection;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.framework.app.CoreBillBaseControllerBean;
import com.kingdee.eas.framework.ObjectBaseCollection;
import com.kingdee.eas.hr.base.CodingRuleManageFacadeFactory;
import com.kingdee.eas.custom.hostelmgr.personrating.PersonRatingCollection;

public class PersonRatingControllerBean extends
		AbstractPersonRatingControllerBean {
	private static Logger logger = Logger
			.getLogger("com.kingdee.eas.custom.hostelmgr.personrating.app.PersonRatingControllerBean");

	protected void setNumberFromCodingRule(Context ctx, IObjectValue model)
			throws BOSException, EASBizException {
		String number = CodingRuleManageFacadeFactory.getLocalInstance(ctx)
				.getNumberFromCodingRule(model, null, null);
		if (number == null)
			return;
		((PersonRatingInfo) model).setNumber(number);
	}

	@Override
	protected void _addnew(Context ctx, IObjectPK pk, IObjectValue model)
			throws BOSException, EASBizException {
		this.setNumberFromCodingRule(ctx, model);
		super._addnew(ctx, pk, model);
	}

	@Override
	protected IObjectPK _addnew(Context ctx, IObjectValue model)
			throws BOSException, EASBizException {
		this.setNumberFromCodingRule(ctx, model);
		return super._addnew(ctx, model);
	}
}